/*
 * Created on 18 mai 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package perception;

import java.awt.Point;
//import maze.*;

/**
 * @author deloor
 *
 * La classe PositionLearnerPerception represente une perception possible
 * correspondant la position du Situated Agent sous la forme de
 * ces coordonnees cartesiennes inserees dans un objet Point
 * 
 */
public class PositionLearnerPerception extends Perception {
//	private maze.SituatedAgent _myAgent;

    public PositionLearnerPerception(maze.SituatedAgent a) {
        _position = new Point();
        _position = a.getPosition();
        setAgent(a);
    }

    public PositionLearnerPerception() {
    }

    public PositionLearnerPerception(PositionLearnerPerception p) {
        _position = new Point(p._position);
        setAgent(p.getAgent());
    }

    @Override
    public PositionLearnerPerception copy() {
        PositionLearnerPerception plp = new PositionLearnerPerception();
        plp._position = new Point(_position);
        plp.setAgent(getAgent());
        return plp;
    }

    @Override
    public void updatePerception() {
        _position = getAgent().getPosition();
    }

    @Override
    public boolean equals(Perception s) {
        PositionLearnerPerception tmp = (PositionLearnerPerception) s;
        return (tmp._position.getX()
                == _position.getX()
                && tmp._position.getY()
                == _position.getY());
    }

    public void display() {
        System.out.println("Etat : " + String.valueOf(_position.getX()) + " " + String.valueOf(_position.getY()));
    }
}
